import numpy as np

x = np.array([1, 2, 3])
y = np.array(
    [
        [0, 0, 0],
        [10, 10, 10],
        [20, 20, 20],
        [30, 30, 30],
    ]
)

# 1.不同行列, 加结果
a = x + y
print(a)
'''
[[ 1  2  3]
 [11 12 13]
 [21 22 23]
 [31 32 33]]
'''

# 2.不同行列, 触发广播, 每行都进行运算
xx = np.tile(x, (4,1))   # 重复x 的各个维度
print(xx + y)
'''
[[ 1  2  3]
 [11 12 13]
 [21 22 23]
 [31 32 33]]
'''